#pragma once

#include "Messages.h"
#include <queue>
using std::queue;

typedef void (*MESSAGEPROC)(CBaseMessage*);

class CSGP_MessageSystem
{
private:
	queue<CBaseMessage*>	m_MsgQueue;
	MESSAGEPROC				m_pfnMsgProc;

	CSGP_MessageSystem() { m_pfnMsgProc = NULL; }
	CSGP_MessageSystem(const CSGP_MessageSystem&);
	CSGP_MessageSystem& operator=(const CSGP_MessageSystem&);

	~CSGP_MessageSystem() {}

public:
	static CSGP_MessageSystem* GetInstance(void);

	// Setup message system
	void InitMessageSystem(MESSAGEPROC pfnMsgProc);

	// Send message to the queue
	void SendMessageA(CBaseMessage* pMsg);

	// Process all messages inside queue
	void ProcessMessages(void);

	// Clear messages
	void ClearMessages(void);

	// Clear messages and shutdown message system
	void ShutdownMessageSystem(void);
};